import serial

ser=serial.Serial('COM5',115200,timeout=1)
# ser.baudrate=115200
# ser.port='COM5'

ser.write('cd /data/local/tmp\r\n'.encode("utf-8"))
ser.flush()
ser.write('ls\r\n'.encode("utf-8"))
ser.flush()
for line in ser.readlines():
    print line
# print ser.readline()
# print ser.readline()
# print ser.readline()
# print ser.readline()
# for line in ser.readlines():
#     print(line)
# str=ser.readline()
# print(str)
# ser.open()
# print(ser.is_open)

# ser.write('cd /data/local/tmp\r\n'.encode("utf-8"))
# ser.write('ls\r\n'.encode("utf-8"))
# n=ser.write('cd /data/app'.encode())
# print(ser.portstr)

# str=ser.read_all()
# print(str)

ser.close()